import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    msg: '这是vuex内的数据',
    count: 0
  },
  mutations: {
    add (state, sum) {
      return state.count += sum
    }
  },
  actions: {
    actadd ({ commit }, sum) {
      setTimeout(() => {
        commit('add', sum)
      }, 1000)
    }
  }
})
